package com.jy.adscm.security.dao.mysql;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.jy.adscm.bean.system.JyRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author yyy
 * @ClassName JyRoleSecurityMapper
 * @Description TODO
 * @date 2018/8/1 14:30
 */
@Mapper
public interface JyRoleSecurityMapper extends BaseMapper<JyRole> {

    /**
     * 获取用户的角色集合
     * @return
     */
    @Select("SELECT r.* FROM jy_role r LEFT JOIN user_role ur ON r.id = ur.role_id  WHERE ur.user_id = #{userId}")
    List<JyRole> queryUsersRole(Integer userId);
}
